<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<!--
Copyright 2008, 2009, 2010 Miguel Ángel Laguna Lobato

This file is part of Multiclinical Trial Web-PACS.

Multiclinical  Trial Web-PACS is free  software: you  can redistribute 
it and/or modify it under  the terms of the GNU General Public License 
as published by the Free  Software Foundation, either version 3 of the 
License, or (at your option) any later version.

Multiclinical  Trial Web-PACS is distributed  in the hope that it will 
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
of  MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
General Public License for more details.

You should have received a copy of the GNU General Public License
along with Multiclinical Trial Web-PACS.  If not, see 
<http://www.gnu.org/licenses/>. 
 -->

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="/jsp/include/templateListAdm.xhtml">

<ui:define name="saveState">
	<t:saveState value="#{userBean.user}" />
	<t:saveState value="#{userBean.allRoles}" />
	<t:saveState value="#{userBean.notAssignedTrials}" />
	<t:saveState value="#{userBean.FSrcObject}" />
</ui:define>

<ui:define name="title">
	<h3>
		<h:outputText value="#{msgs['jsf.headers.UserTrials']} : "/>
		<h:outputText value="#{userBean.user.fullName}" />
	</h3>
</ui:define>

<ui:define name="searchForm">
	<h:panelGrid columns="3">
		
		<h:outputLabel value="Roles" styleClass="frmLabel"/>
		<h:selectOneMenu id="rol"  value="#{userBean.rolSelected}" styleClass="frmSelectOne">
			<f:selectItems value="#{userBean.allRoles}" />
		</h:selectOneMenu>
		<t:message id="rolError" for="rol" />	
		
		<h:outputLabel value="Trials" styleClass="frmLabel"/>
		<h:selectOneMenu id="trial"  value="#{userBean.trialSelected}" styleClass="frmSelectOne">
			<f:selectItems value="#{userBean.notAssignedTrials}" />
		</h:selectOneMenu>
		<t:message id="trialError" for="trial" />	
		
		<f:facet name="footer">
			<h:panelGroup styleClass="footFrm">
				<h:commandButton id="anadir" value="#{msgs['jsf.actions.Add']}" action="#{userBean.accAddParticipationUser}" styleClass="frmButton" />
				<h:commandButton id="volver" value="#{msgs['jsf.actions.Back']}" action="#{userBean.accFindUser}" styleClass="frmButton" />
			</h:panelGroup>
		</f:facet>	

	</h:panelGrid>
</ui:define>

<ui:define name="tableResult">
	<p:dataTable 
		id="results"
		var="row" rows="10"
		paginator="true" 
		paginatorPosition="bottom"  
		value="#{userBean.user.participationsList}">
			
		<p:column
			parser="string"
			sortBy="#{row.rol.name}">
			<f:facet name="header">
				<h:outputText value="#{msgs['jsf.generic.Rol']}" />
			</f:facet>
			<h:outputText value="#{row.rol.name}"/>
		</p:column>
	
		<p:column
			parser="string"
			sortBy="#{row.trial.name}">
			<f:facet name="header">
				<h:outputText value="#{msgs['jsf.generic.Trial']}" />
			</f:facet>
			<h:outputText value="#{row.trial.name}" />
		</p:column>
		
		<p:column
			parser="string"
			sortBy="#{row.user.fullName}">
			<f:facet name="header">
				<h:outputText value="#{msgs['jsf.generic.User']}" />
			</f:facet>
				<h:outputText value="#{row.user.fullName}" />
		</p:column>		

		<p:column>
			<f:facet name="header">
				<h:outputText value="#{msgs['jsf.actions']}" />
			</f:facet>
			
			<t:commandLink action="#{userBean.accDelParticipationUser}" immediate="true">
				<h:graphicImage value="/jsp/icons/cross.png" 
				alt="#{msgs['jsf.actions.Delete']}" title="#{msgs['jsf.actions.Delete']}" />
				<t:updateActionListener value="#{row}" property="#{userBean.partSelected}"/>
			</t:commandLink>
		</p:column>										
	</p:dataTable>	
</ui:define>

</ui:composition>

</html>